package framework.view.components.container
{
import flash.display.MovieClip;

import framework.proxy.ComponentProxy;
import framework.view.components.button.ButtonProxy;

/**
 * ListProxy
 * @author jliang
 * 
 */
public class ListProxy extends ComponentProxy
{
    //==========================================================================
    //  Constructor
    //==========================================================================
    public function ListProxy()
    {
        super();
    }
    //==========================================================================
    //  Properties
    //==========================================================================
    protected var prevBtn:ButtonProxy;
    protected var nextBtn:ButtonProxy;
    
    public function get isPaging():Boolean
    {
        return prevBtn && nextBtn;
    }
    //==========================================================================
    //  Overridden methods: ComponentProxy
    //==========================================================================
    override public function parse(target:MovieClip):void
    {
        super.parse(target);
        if (skin.getChildByName("prevBtn") && skin.getChildByName("nextBtn")) 
        {
            prevBtn = new ButtonProxy();
            prevBtn.parse(skin.getChildByName("prevBtn") as MovieClip);
            prevBtn.onClick = clickToPrevHandler;
            
            nextBtn = new ButtonProxy();
            nextBtn.parse(skin.getChildByName("nextBtn") as MovieClip);
            nextBtn.onClick = clickToNextHandler;
        }
        
    }
    
    override public function dispose():void
    {
        if (nextBtn)
        {
            nextBtn.dispose();
        }
        if (prevBtn)
        {
            prevBtn.dispose();
        }
        super.dispose();
    }
    
    protected function clickToPrevHandler():void
    {
        
    }
    
    protected function clickToNextHandler():void
    {
        
    }
}
}


